<!--  -->
<template>
  <div class="block-item-wrapper" ref="blockItemWrapper">
    <div class="line" ref="blockLine"></div>
    <p class="title hy-35J" ref="blockTitle"></p>
    <ul class="block-item-list">
      <li v-for="(item, index) in params.list" :key="index">
        <blockItemItem :params="item" :index="index"></blockItemItem>
      </li>
    </ul>
  </div>
</template>

<script>
import blockItemItem from './blockItemItem'
export default {
  name: '',
  components: {
    blockItemItem
  },
  data() {
    return {}
  },
  props: ['params'],
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    init() {
      let tl = new TimelineMax({})
      let blockItemItem = app.partServer.getCompByTagName('blockItemItem'),
        len = blockItemItem.length
      let blockItemWrapper = TweenMax.to(this.$refs.blockItemWrapper, 0.3, {
        opacity: 1,
        scale: 1
      })
      let blockLine = TweenMax.to(this.$refs.blockLine, 0.3, {
        opacity: 1,
        width: '72px'
      })
      let blockTitle = () => {
        TweenMax.to(this.$refs.blockTitle, 0.5, {
          opacity: 1,
          scrambleText: {
            text: this.params.title,
            chars: '_ ',
            speed: 0.3
          }
        })
      }
      tl.addLabel('start')
        .add(blockItemWrapper, 'start+=0')
        .add(blockLine, 'start+=0.1')
        .add(blockTitle, 'start+=0.2')
      for (let i = 0; i < len; i++) {
        tl.add(blockItemItem[i].init(), 'start+=' + (i * 0.1 + 0.3))
      }
      return tl
    }
  }
}
</script>
<style lang="scss" scoped>
//@import url(); 引入公共css类
.block-item-wrapper {
  width: 100%;
  height: 100%;
  background: url('../../../assets/imgs/center/block-bg.png') no-repeat;
  background-size: 100% 100%;
  opacity: 0;
  transform: scale(0);
}
.line {
  position: absolute;
  width: 0;
  height: 4px;
  left: 13px;
  top: 29px;
  background: #035ef0;
  opacity: 0;
}
.title {
  position: absolute;
  right: 20px;
  top: 13px;
  font-size: 18px;
  color: #fff;
  font-weight: bold;
  text-shadow: 3px 0 5px rgba(37, 160, 255, 0.6),
    -3px 0 5px rgba(37, 160, 255, 0.6), 0 3px 5px rgba(37, 160, 255, 0.6),
    0 -3px 5px rgba(37, 160, 255, 0.6);
}
.block-item-list {
  position: absolute;
  left: 0;
  top: 55px;

  li {
    width: 100%;
    height: 14px;
    margin-bottom: 10px;
  }
}
</style>
